<template>
  <div>
    <h2>student姓名：{{name}}</h2>
    <h2>student年龄：{{age}}</h2>
    <h2>student性别：{{gender}}</h2>
    <button @click="showInof()">显示student信息</button>
  </div>
</template>
  
<script>
  export default {
    name: 'Student',
    props: ['name', 'age'],//子组件通过props接受父组件传递过来的数据
    data() {
      return {
        gender: '男'  
      }
    },
    methods: {
        showInof() {
          alert(this.name + " : " + this.age);
        }
    }
  }
</script>
 
<style scoped>
     
</style>